from mbsh.core.models import ImageData, SmallModel


__author__ = 'gpu'

import os
import mbsh
import unittest
import tempfile
import os

from mbsh import create_app, db


class AdminTestCase(unittest.TestCase):
    def setUp(self):
        app = create_app(os.getenv('FLASK_CONFIG') or 'default')
        app.app_context().push()
        self.app = app

    def tearDown(self):
        print('tear down')
        # os.unlink(mbsh.app.config['DATABASE'])


    def test_list_page(self):
        pc = {'page': 0, 'pageSize': 50, 'filterParams': []}
        result = ImageData.list_page(ImageData, pc)
        print(result)

    def test_python(self):
        print('%s,count=%s' % (2, 1))
        print(os.path.dirname(r'E:\projects\znyx\data\imgs_wei\classes\test'))
        for i, k in enumerate(["2222", "2kk"]):
            print("%s,%s" % (i, k))

        a = {'a': 1}
        b = dict(a, **{'k': 2})
        print(b)

        a=''
        data=a.split(",")[1]
        print(bytes(data,'utf-8'))

    def test_lambda(self):
        def foo(n):
            return lambda i: (n+i)
        print(foo(1)(2))


if __name__ == '__main__':
    unittest.main()
